package easycloud.ecs.common.domain;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

import easycloud.ecs.provider.model.IStorageObjectMetadata;

/**
 * Item entity.
 */
@Entity
@Table(name = "item")
public class Item extends AbstractItem implements Serializable,
		IStorageObjectMetadata {

	public enum ITEM_STATUS {
		NOSTATUS, LOCAL_NEW, LOCAL_UPDATE, LOCAL_DELETE, UNCHANGE, REMOTE_NEW, REMOTE_UPDATE, REMOTE_DELETE, CONFLICT
	}

	/**
	 * 
	 */
	private static final long serialVersionUID = -465005701862737497L;

	@Transient
	private ITEM_STATUS status;

	@Override
	public String getHash(Provider provider) {
		for (Hash hash : getHashs()) {
			if (hash.getProvider().equals(provider)) {
				return hash.getHash();
			}
		}
		return "";
	}

	@Override
	public Item getItem() {
		return this;
	}

	public ITEM_STATUS getStatus() {
		return status;
	}

	public void setStatus(ITEM_STATUS status) {
		this.status = status;
	}

}
